Fix cygwin build and simplify feature detection in 'configure' script
PATCH 1/1 Fix cygwin build and simplify feature detection in 'configure' script
Feature detection didn't work properly under cygwin because the OS_CFLAGS=-mno-cygwin
flags was not passed to the feature checks (which only used $ARCH_CFLAGS). The end
result being that features were detected against the mostly-Posix Cygwin headers,
while compilation happened against the Mingw headers which lack many headers like
<sys/uio.h>, <fnmatch.h> and others.
Also, an OS_LDFLAGS=-mno-cygwin was missing, resulting in a link-time error
Finally, three helper functions are introduced to simplify feature detection within
the configure script: check_compile, check_link and check_link_with_log. Feature
detection code was modified to use them instead of directly calling $cc with a really
long list of arguments.
--- configure | 98 +++++++++++++++++++++++++++++++++++-------------------------- 1 files changed, 56 insertions(+), 42 deletions(-)
configure +18 -4
@@ -73,7 +73,21 @@ cat > $TMPC <<EOF #endif int main(void) { return 0; } EOF - $cc $ARCH_CFLAGS -c -o $TMPO $TMPC > /dev/null 2> /dev/null + $cc $ARCH_CFLAGS -c -o $TMPO $TMPC ${OS_CFLAGS} > /dev/null 2> /dev/null +} + +check_compile() { + $cc $ARCH_CFLAGS $OS_CFLAGS -c -o $TMPO $TMPC > /dev/null 2> /dev/null +} + +check_link() { + $cc $ARCH_CFLAGS $OS_CFLAGS -o $TMPE $TMPC $* > /dev/null 2> /dev/null +} + +check_link_with_log() { + TMPLOG=$1 + shift + $cc $ARCH_CFLAGS $OS_CFLAGS -o $TMPE $TMPC $* > $TMPLOG 2>&1 } if check_define __i386__ ; then
@@ -216,6 +230,7 @@ case $targetos in CYGWIN*) mingw32="yes" OS_CFLAGS="-mno-cygwin" +OS_LDFLAGS="-mno-cygwin" if [ "$cpu" = "i386" ] ; then kqemu="yes" fi
@@ -763,7 +778,7 @@ int main(int argc, char ** argv){ } EOF -if $cc $ARCH_CFLAGS -o $TMPE $TMPC > /dev/null 2> /dev/null ; then +if check_link; then $TMPE && bigendian="yes" else echo big/little test failed
@@ -809,7 +824,7 @@ void foo() } EOF -if $cc $ARCH_CFLAGS -c -o $TMPO $TMPC > /dev/null 2> /dev/null ; then +if check_compile; then : else nptl="no"
@@ -822,7 +837,7 @@ cat > $TMPC << EOF #include <zlib.h> int main(void) { zlibVersion(); return 0; } EOF -if $cc $ARCH_CFLAGS -o $TMPE ${OS_CFLAGS} $TMPC -lz > /dev/null 2>
/dev/null ; then
+if check_link -lz; then
:
else
echo
@@ -841,7 +856,7 @@ cat > $TMPC <<EOF
#include <xs.h>
int main(void) { xs_daemon_open; xc_interface_open; } EOF
- if $cc $ARCH_CFLAGS -c -o $TMPO $TMPC -lxenstore -lxenctrl 2> /dev/null
Quoted 1 line
/dev/null; then
+ if check_link -lxenstore -lxenctrl; then
:
else
xen="no"@@ -855,6 +870,8 @@ sdl_too_old=no
if test "$sdl" = "yes" ; then
sdl_config="sdl-config"
+ sdl_cflags=$sdl_config --cflags 2> /dev/null
+ sdl_ldflags=$sdl_config --libs 2> /dev/null
sdl=no
sdl_static=no
@@ -863,7 +880,7 @@ cat > $TMPC << EOF
#undef main /* We don't want SDL to override our main() */
int main( void ) { return SDL_Init (SDL_INIT_VIDEO); }
EOF
- if $cc $ARCH_CFLAGS -o $TMPE ${OS_CFLAGS} `$sdl_config --cflags 2>/dev/null $TMPC $sdl_config --libs 2> /dev/null` > $TMPSDLLOG 2>&1 ; then
+ if check_link_with_log $TMPSDLLOG $sdl_cflags $sdl_ldflags; then
_sdlversion=$sdl_config --version | sed 's/[^0-9]//g' if test "$_sdlversion" -lt 121 ; then
sdl_too_old=yes
@@ -882,7 +899,7 @@ EOF
sdl_static_libs="$sdl_static_libs `aalib-config
--static-libs`"
fi
- if $cc -o $TMPE ${OS_CFLAGS} `$sdl_config --cflags 2>
/dev/null` $TMPC $sdl_static_libs > /dev/null 2> /dev/null; then
+ if check_link $sdl_config --cflags 2> /dev/null
$sdl_static_libs; then
sdl_static=yes
fi
fi # static link
@@ -905,8 +922,8 @@ cat > $TMPC <<EOF
#endif
int main(void) { return 0; }
EOF
- if $cc $ARCH_CFLAGS -o $TMPE ${OS_CFLAGS} `$sdl_config --cflags 2>/dev/null $TMPC $sdl_config --libs 2> /dev/null` > /dev/null 2>&1 ; then
- sdl_x11="yes"
+ if check_link $sdl_cflags $sdl_ldflags; then
+ sdl_x11="yes"
fi
fi
@@ -919,11 +936,10 @@ int main(void) { gnutls_session_t s; gnutls_init(&s, GNUTLS_SERVER); return 0; }
EOF
vnc_tls_cflags=`pkg-config --cflags gnutls 2> /dev/null`
vnc_tls_libs=`pkg-config --libs gnutls 2> /dev/null`- if $cc $ARCH_CFLAGS -o $TMPE ${OS_CFLAGS} $vnc_tls_cflags $TMPC \
- $vnc_tls_libs > /dev/null 2> /dev/null ; then
- :
+ if check_link $vnc_tls_cflags $vnc_tls_libs; then
+ :
else
- vnc_tls="no"
+ vnc_tls="no"
fi
fi
@@ -938,11 +954,10 @@ EOF
# Assuming Cyrus-SASL installed in /usr prefix
vnc_sasl_cflags=""
vnc_sasl_libs="-lsasl2"- if $cc $ARCH_CFLAGS -o $TMPE ${OS_CFLAGS} $vnc_sasl_cflags $TMPC \
- $vnc_sasl_libs 2> /dev/null > /dev/null ; then
- :
+ if check_link $vnc_sasl_cflags $vnc_sasl_libs; then
+ :
else
- vnc_sasl="no"
+ vnc_sasl="no"
fi
fi
@@ -957,7 +972,7 @@ int main(void)
return 0;
}
EOF
-if $cc $ARCH_CFLAGS -o $TMPE $TMPC > /dev/null 2> /dev/null ; then +if check_link; then
fnmatch="yes"
fi
@@ -973,7 +988,7 @@ int main(void)
return 0;
}
EOF
- if $cc $ARCH_CFLAGS -o $TMPE $TMPC -lvdeplug > /dev/null 2> /dev/null ;
then
+ if check_link -lvdeplug; then
:
else
vde="no"@@ -994,7 +1009,7 @@ audio_drv_probe()
#include <$hdr>
int main(void) { $exp }
EOF
- if $cc $ARCH_CFLAGS $cfl -o $TMPE $TMPC $lib > /dev/null 2> /dev/null ;
then
+ if check_link $cfl $lib; then
:
else
echo@@ -1058,8 +1073,8 @@ cat > $TMPC << EOF
#include <brlapi.h>
int main( void ) { return brlapi__openConnection (NULL, NULL, NULL); } EOF
- if $cc ${ARCH_CFLAGS} -o $TMPE ${OS_CFLAGS} $TMPC -lbrlapi > /dev/null
2> /dev/null ; then
- brlapi=yes
+ if check_link -lbrlapi; then
+ brlapi=yes
fi # brlapi compile test
fi # -z $brlapi
@@ -1075,7 +1090,7 @@ if test "$curses" = "yes" ; then
#endif
int main(void) { resize_term(0, 0); return curses_version(); } EOF
- if $cc $ARCH_CFLAGS -o $TMPE $TMPC -lcurses > /dev/null 2> /dev/null ; then
+ if check_link -lcurses; then
curses=yes
fi
fi # test "$curses"
@@ -1089,8 +1104,9 @@ if test "$curl" = "yes" ; then
#include <curl/curl.h>
int main(void) { return curl_easy_init(); }
EOF
+ curl_cflags=curl-cflags --cflags 2>/dev/null curl_libs=curl-config --libs 2>/dev/null
- if $cc $ARCH_CFLAGS $curl_libs -o $TMPE $TMPC > /dev/null 2> /dev/null ; then
+ if check_link $curl_cflags $curl_libs; then
curl=yes
fi
fi # test "$curl"
@@ -1107,8 +1123,7 @@ int main(void) { return bt_error(0); }
EOF
bluez_cflags=pkg-config --cflags bluez 2> /dev/null bluez_libs=pkg-config --libs bluez 2> /dev/null
- if $cc $ARCH_CFLAGS -o $TMPE ${OS_CFLAGS} $bluez_cflags $TMPC \
- $bluez_libs > /dev/null 2> /dev/null ; then
+ if check_link $bluez_cflags $bluez_libs; then
:
else
bluez="no"
@@ -1139,24 +1154,23 @@ EOF
if test \( "$cpu" = "i386" -o "$cpu" = "x86_64" \) \
-a -d "$kerneldir/arch/x86/include" ; then
kvm_cflags="$kvm_cflags -I$kerneldir/arch/x86/include"- elif test "$cpu" = "ppc" -a -d "$kerneldir/arch/powerpc/include" ; then
- kvm_cflags="$kvm_cflags -I$kerneldir/arch/powerpc/include"
+ elif test "$cpu" = "ppc" -a -d "$kerneldir/arch/powerpc/include" ; then
+ kvm_cflags="$kvm_cflags -I$kerneldir/arch/powerpc/include"
elif test -d "$kerneldir/arch/$cpu/include" ; then
kvm_cflags="$kvm_cflags -I$kerneldir/arch/$cpu/include"
fi
else
kvm_cflags=""
fi
- if $cc $ARCH_CFLAGS -o $TMPE ${OS_CFLAGS} $kvm_cflags $TMPC \
- > /dev/null 2>/dev/null ; then
+ if check_link $kvm_cflags; then
:
else
kvm="no";
if [ -x "`which awk 2>/dev/null`" ] && \
[ -x "`which grep 2>/dev/null`" ]; then
kvmerr=`LANG=C $cc $ARCH_CFLAGS -o $TMPE ${OS_CFLAGS} $kvm_cflags$TMPC 2>&1 \
- | grep "error: " \
- | awk -F "error: " '{if (NR>1) printf(", "); printf("%s",$2);}'`
+ | grep "error: " \
+ | awk -F "error: " '{if (NR>1) printf(", "); printf("%s",$2);}'`
if test "$kvmerr" != "" ; then
kvm="no - (${kvmerr})\n\
NOTE: To enable KVM support, update your kernel to 2.6.29+ or install \@@ -1178,7 +1192,7 @@ cat > $TMPC << EOF
int main(void) { pthread_create(0,0,0,0); return 0; } EOF
for pthread_lib in $PTHREADLIBS_LIST; do
- if $cc $ARCH_CFLAGS -o $TMPE $TMPC $pthread_lib 2> /dev/null >/dev/null ; then
+ if check_link $pthread_lib; then
pthread=yes
PTHREADLIBS="$pthread_lib"
break
@@ -1200,7 +1214,7 @@ cat > $TMPC <<EOF
int main(void) { struct iovec iov; return 0; }
EOF
iovec=no
-if $cc $ARCH_CFLAGS -o $TMPE $TMPC > /dev/null 2> /dev/null ; then +if check_link; then
iovec=yes
fi
@@ -1213,7 +1227,7 @@ cat > $TMPC <<EOF
int main(void) { preadv; }
EOF
preadv=no
-if $cc $ARCH_CFLAGS -o $TMPE $TMPC > /dev/null 2> /dev/null ; then +if check_link; then
preadv=yes
fi
@@ -1224,7 +1238,7 @@ if test "$fdt" = "yes" ; then
cat > $TMPC << EOF
int main(void) { return 0; }
EOF
- if $cc $ARCH_CFLAGS -o $TMPE ${OS_CFLAGS} $TMPC -lfdt 2> /dev/null > /dev/null ; then
+ if check_link -lfdt; then
fdt=yes
fi
fi
@@ -1249,7 +1263,7 @@ main(void)
return (unlinkat(AT_FDCWD, "nonexistent_file", 0));
}
EOF
- if $cc $ARCH_CFLAGS -o $TMPE $TMPC 2> /dev/null > /dev/null ; then
+ if check_link; then
atfile=yes
fi
fi
@@ -1271,7 +1285,7 @@ main(void)
return inotify_init();
}
EOF
- if $cc $ARCH_CFLAGS -o $TMPE $TMPC 2> /dev/null > /dev/null ; then
+ if check_link; then
inotify=yes
fi
fi
@@ -1291,9 +1305,9 @@ int main(void) { clockid_t id; return clock_gettime(id, NULL); }
EOF
rt=no
-if $cc $ARCH_CFLAGS -o $TMPE $TMPC > /dev/null 2> /dev/null ; then +if check_link; then
:
-elif $cc $ARCH_CFLAGS -o $TMPE $TMPC -lrt > /dev/null 2> /dev/null ; then +elif check_link -lrt; then
rt=yes
fi
@@ -1529,7 +1543,7 @@ else
#include <byteswap.h>
int main(void) { return bswap_32(0); }
EOF
- if $cc $ARCH_CFLAGS -o $TMPE $TMPC >/dev/null 2> /dev/null ; then
+ if check_link; then
echo "#define HAVE_BYTESWAP_H 1" >> $config_h
fi
cat > $TMPC << EOF
@@ -1538,7 +1552,7 @@ EOF
#include <machine/bswap.h>
int main(void) { return bswap32(0); }
EOF
- if $cc $ARCH_CFLAGS -o $TMPE $TMPC >/dev/null 2> /dev/null ; then
+ if check_link; then
echo "#define HAVE_MACHINE_BSWAP_H 1" >> $config_h
fi
fi
Signature · 1 line
1.6.1.2
As a related note, is anyone seriously using/developing the mainline QEMU sources on/for Windows?
If so, what is the recommended environment to do so? I'm currently using cygwin to generate
mingw-linked binaries (which dont require cygwin.dll at runtime), but I can think of other ways
to generate these:
- using MSYS + mingw
- using mingw and the Windows command line
- using Linux and the linux-mingw32 toolchain
Finally, what is the best way to send patches to this list?. I notice that many patches are also sent
directly to various developers, and that they tend to get reviewed/accepted/rejected a tad more rapidly.
Is it ok to send patches as attachments ? or should they be sent with git-send-email instead?
By the way, I'd be happy to regularly check the Windows mainline build if that can help.
I'm also preparing a series of patches that fix several Windows-specific issues (most of them related
to this horrible thing they called Winsock...).
Thanks for your time.
- David
Quoted 372 lines · David Turner
Feature detection didn't work properly under cygwin because the OS_CFLAGS=-mno-cygwin
flags was not passed to the feature checks (which only used $ARCH_CFLAGS). The end
result being that features were detected against the mostly-Posix Cygwin headers,
while compilation happened against the Mingw headers which lack many headers like
<sys/uio.h>, <fnmatch.h> and others.Also, an OS_LDFLAGS=-mno-cygwin was missing, resulting in a link-time error
Finally, three helper functions are introduced to simplify feature detection within
the configure script:check_compile,check_linkandcheck_link_with_log. Feature
detection code was modified to use them instead of directly calling $cc with a really
long list of arguments.Signed-off-by digit <[email protected]>--- configure | 98 +++++++++++++++++++++++++++++++++++-------------------------- 1 files changed, 56 insertions(+), 42 deletions(-)configure +18
-4@@ -73,7 +73,21 @@ cat > $TMPC <<EOF #endif int main(void) { return 0; } EOF - $cc $ARCH_CFLAGS -c -o $TMPO $TMPC > /dev/null 2> /dev/null + $cc $ARCH_CFLAGS -c -o $TMPO $TMPC ${OS_CFLAGS} > /dev/null 2> /dev/null +} + +check_compile() { + $cc $ARCH_CFLAGS $OS_CFLAGS -c -o $TMPO $TMPC > /dev/null 2> /dev/null +} + +check_link() { + $cc $ARCH_CFLAGS $OS_CFLAGS -o $TMPE $TMPC $* > /dev/null 2> /dev/null +} + +check_link_with_log() { + TMPLOG=$1 + shift + $cc $ARCH_CFLAGS $OS_CFLAGS -o $TMPE $TMPC $* > $TMPLOG 2>&1 } if check_define __i386__ ; then@@ -216,6 +230,7 @@ case $targetos in CYGWIN*) mingw32="yes" OS_CFLAGS="-mno-cygwin" +OS_LDFLAGS="-mno-cygwin" if [ "$cpu" = "i386" ] ; then kqemu="yes" fi@@ -763,7 +778,7 @@ int main(int argc, char ** argv){ } EOF -if $cc $ARCH_CFLAGS -o $TMPE $TMPC > /dev/null 2> /dev/null ; then +if check_link; then $TMPE && bigendian="yes" else echo big/little test failed@@ -809,7 +824,7 @@ void foo() } EOF -if $cc $ARCH_CFLAGS -c -o $TMPO $TMPC > /dev/null 2> /dev/null ; then +if check_compile; then : else nptl="no"@@ -822,7 +837,7 @@ cat > $TMPC << EOF #include <zlib.h> int main(void) { zlibVersion(); return 0; } EOF -if $cc $ARCH_CFLAGS -o $TMPE ${OS_CFLAGS} $TMPC -lz > /dev/null 2>
/dev/null; thenconfigure +1
-1+if check_link -lz; then : else echo@@ -841,7 +856,7 @@ cat > $TMPC <<EOF #include <xs.h> int main(void) { xs_daemon_open; xc_interface_open; } EOF - if $cc $ARCH_CFLAGS -c -o $TMPO $TMPC -lxenstore -lxenctrl 2> /dev/nullQuoted 1 line
/dev/null; thenconfigure +3
-1+ if check_link -lxenstore -lxenctrl; then : else xen="no"@@ -855,6 +870,8 @@ sdl_too_old=no if test "$sdl" = "yes" ; then sdl_config="sdl-config" + sdl_cflags=`$sdl_config --cflags 2> /dev/null` + sdl_ldflags=`$sdl_config --libs 2> /dev/null` sdl=no sdl_static=no@@ -863,7 +880,7 @@ cat > $TMPC << EOF #undef main /* We don't want SDL to override our main() */ int main( void ) { return SDL_Init (SDL_INIT_VIDEO); } EOF - if $cc $ARCH_CFLAGS -o $TMPE ${OS_CFLAGS} `$sdl_config --cflags 2>
/dev/null$TMPC$sdl_config --libs 2> /dev/null` > $TMPSDLLOG 2>&1 ; thenconfigure +1
-2+ if check_link_with_log $TMPSDLLOG $sdl_cflags $sdl_ldflags; then _sdlversion=`$sdl_config --version | sed 's/[^0-9]//g'` if test "$_sdlversion" -lt 121 ; then sdl_too_old=yes@@ -882,7 +899,7 @@ EOF sdl_static_libs="$sdl_static_libs `aalib-config --static-libs`" fi - if $cc -o $TMPE ${OS_CFLAGS} `$sdl_config --cflags 2>/dev/null` $TMPC $sdl_static_libs >
/dev/null2>/dev/null; then
+ ifcheck_link$sdl_config --cflags 2> /dev/null
$sdl_static_libs; then
sdl_static=yes
fi
fi # static linkconfigure +0
-1@@ -905,8 +922,8 @@ cat > $TMPC <<EOF #endif int main(void) { return 0; } EOF - if $cc $ARCH_CFLAGS -o $TMPE ${OS_CFLAGS} `$sdl_config --cflags 2>
/dev/null$TMPC$sdl_config --libs 2> /dev/null` >/dev/null2>&1 ; then
- sdl_x11="yes"configure +9
-10+ if check_link $sdl_cflags $sdl_ldflags; then + sdl_x11="yes" fi fi@@ -919,11 +936,10 @@ int main(void) { gnutls_session_t s; gnutls_init(&s, GNUTLS_SERVER); return 0; } EOF vnc_tls_cflags=`pkg-config --cflags gnutls 2> /dev/null` vnc_tls_libs=`pkg-config --libs gnutls 2> /dev/null` - if $cc $ARCH_CFLAGS -o $TMPE ${OS_CFLAGS} $vnc_tls_cflags $TMPC \ - $vnc_tls_libs > /dev/null 2> /dev/null ; then - : + if check_link $vnc_tls_cflags $vnc_tls_libs; then + : else - vnc_tls="no" + vnc_tls="no" fi fi@@ -938,11 +954,10 @@ EOF # Assuming Cyrus-SASL installed in /usr prefix vnc_sasl_cflags="" vnc_sasl_libs="-lsasl2" - if $cc $ARCH_CFLAGS -o $TMPE ${OS_CFLAGS} $vnc_sasl_cflags $TMPC \ - $vnc_sasl_libs 2> /dev/null > /dev/null ; then - : + if check_link $vnc_sasl_cflags $vnc_sasl_libs; then + : else - vnc_sasl="no" + vnc_sasl="no" fi fi@@ -957,7 +972,7 @@ int main(void) return 0; } EOF -if $cc $ARCH_CFLAGS -o $TMPE $TMPC > /dev/null 2> /dev/null ; then +if check_link; then fnmatch="yes" fi@@ -973,7 +988,7 @@ int main(void) return 0; } EOF - if $cc $ARCH_CFLAGS -o $TMPE $TMPC -lvdeplug > /dev/null 2> /dev/null; then
configure +1
-1+ if check_link -lvdeplug; then : else vde="no"@@ -994,7 +1009,7 @@ audio_drv_probe() #include <$hdr> int main(void) { $exp } EOF - if $cc $ARCH_CFLAGS $cfl -o $TMPE $TMPC $lib > /dev/null 2> /dev/null; then
configure +1
-1+ if check_link $cfl $lib; then : else echo@@ -1058,8 +1073,8 @@ cat > $TMPC << EOF #include <brlapi.h> int main( void ) { return brlapi__openConnection (NULL, NULL, NULL); } EOF - if $cc ${ARCH_CFLAGS} -o $TMPE ${OS_CFLAGS} $TMPC -lbrlapi > /dev/null2>
/dev/null; thenconfigure +2
-2- brlapi=yes + if check_link -lbrlapi; then + brlapi=yes fi # brlapi compile test fi # -z $brlapi@@ -1075,7 +1090,7 @@ if test "$curses" = "yes" ; then #endif int main(void) { resize_term(0, 0); return curses_version(); } EOF - if $cc $ARCH_CFLAGS -o $TMPE $TMPC -lcurses > /dev/null 2> /dev/null ;then
configure +2
-1+ if check_link -lcurses; then curses=yes fi fi # test "$curses"@@ -1089,8 +1104,9 @@ if test "$curl" = "yes" ; then #include <curl/curl.h> int main(void) { return curl_easy_init(); } EOF + curl_cflags=`curl-cflags --cflags 2>/dev/null` curl_libs=`curl-config --libs 2>/dev/null` - if $cc $ARCH_CFLAGS $curl_libs -o $TMPE $TMPC > /dev/null 2> /dev/null ;then
+ ifcheck_link$curl_cflags $curl_libs; then
curl=yes
fi
fi # test "$curl"configure +2
-4@@ -1107,8 +1123,7 @@ int main(void) { return bt_error(0); } EOF bluez_cflags=`pkg-config --cflags bluez 2> /dev/null` bluez_libs=`pkg-config --libs bluez 2> /dev/null` - if $cc $ARCH_CFLAGS -o $TMPE ${OS_CFLAGS} $bluez_cflags $TMPC \ - $bluez_libs > /dev/null 2> /dev/null ; then + if check_link $bluez_cflags $bluez_libs; then : else bluez="no"@@ -1139,24 +1154,23 @@ EOF if test \( "$cpu" = "i386" -o "$cpu" = "x86_64" \) \ -a -d "$kerneldir/arch/x86/include" ; then kvm_cflags="$kvm_cflags -I$kerneldir/arch/x86/include" - elif test "$cpu" = "ppc" -a -d "$kerneldir/arch/powerpc/include" ; then - kvm_cflags="$kvm_cflags -I$kerneldir/arch/powerpc/include" + elif test "$cpu" = "ppc" -a -d "$kerneldir/arch/powerpc/include" ;then
configure +2
-2+ kvm_cflags="$kvm_cflags -I$kerneldir/arch/powerpc/include" elif test -d "$kerneldir/arch/$cpu/include" ; then kvm_cflags="$kvm_cflags -I$kerneldir/arch/$cpu/include" fi else kvm_cflags="" fi - if $cc $ARCH_CFLAGS -o $TMPE ${OS_CFLAGS} $kvm_cflags $TMPC \ - > /dev/null 2>/dev/null ; then + if check_link $kvm_cflags; then : else kvm="no"; if [ -x "`which awk 2>/dev/null`" ] && \ [ -x "`which grep 2>/dev/null`" ]; then kvmerr=`LANG=C $cc $ARCH_CFLAGS -o $TMPE ${OS_CFLAGS} $kvm_cflags$TMPC 2>&1 \
- | grep "error: " \
- | awk -F "error: " '{if (NR>1)printf(", "); printf("%s",$2);}'`configure +2
-0+ | grep "error: " \ + | awk -F "error: " '{if (NR>1) printf(", "); printf("%s",$2);}'` if test "$kvmerr" != "" ; then kvm="no - (${kvmerr})\n\ NOTE: To enable KVM support, update your kernel to 2.6.29+ or install\
configure +0
-1@@ -1178,7 +1192,7 @@ cat > $TMPC << EOF int main(void) { pthread_create(0,0,0,0); return 0; } EOF for pthread_lib in $PTHREADLIBS_LIST; do - if $cc $ARCH_CFLAGS -o $TMPE $TMPC $pthread_lib 2> /dev/null >
/dev/null; thenconfigure +3
-3+ if check_link $pthread_lib; then pthread=yes PTHREADLIBS="$pthread_lib" break@@ -1200,7 +1214,7 @@ cat > $TMPC <<EOF int main(void) { struct iovec iov; return 0; } EOF iovec=no -if $cc $ARCH_CFLAGS -o $TMPE $TMPC > /dev/null 2> /dev/null ; then +if check_link; then iovec=yes fi@@ -1213,7 +1227,7 @@ cat > $TMPC <<EOF int main(void) { preadv; } EOF preadv=no -if $cc $ARCH_CFLAGS -o $TMPE $TMPC > /dev/null 2> /dev/null ; then +if check_link; then preadv=yes fi@@ -1224,7 +1238,7 @@ if test "$fdt" = "yes" ; then cat > $TMPC << EOF int main(void) { return 0; } EOF - if $cc $ARCH_CFLAGS -o $TMPE ${OS_CFLAGS} $TMPC -lfdt 2> /dev/null >
/dev/null; thenconfigure +7
-7+ if check_link -lfdt; then fdt=yes fi fi@@ -1249,7 +1263,7 @@ main(void) return (unlinkat(AT_FDCWD, "nonexistent_file", 0)); } EOF - if $cc $ARCH_CFLAGS -o $TMPE $TMPC 2> /dev/null > /dev/null ; then + if check_link; then atfile=yes fi fi@@ -1271,7 +1285,7 @@ main(void) return inotify_init(); } EOF - if $cc $ARCH_CFLAGS -o $TMPE $TMPC 2> /dev/null > /dev/null ; then + if check_link; then inotify=yes fi fi@@ -1291,9 +1305,9 @@ int main(void) { clockid_t id; return clock_gettime(id, NULL); } EOF rt=no -if $cc $ARCH_CFLAGS -o $TMPE $TMPC > /dev/null 2> /dev/null ; then +if check_link; then : -elif $cc $ARCH_CFLAGS -o $TMPE $TMPC -lrt > /dev/null 2> /dev/null ; then +elif check_link -lrt; then rt=yes fi@@ -1529,7 +1543,7 @@ else #include <byteswap.h> int main(void) { return bswap_32(0); } EOF - if $cc $ARCH_CFLAGS -o $TMPE $TMPC >/dev/null 2> /dev/null ; then + if check_link; then echo "#define HAVE_BYTESWAP_H 1" >> $config_h fi cat > $TMPC << EOF@@ -1538,7 +1552,7 @@ EOF #include <machine/bswap.h> int main(void) { return bswap32(0); } EOF - if $cc $ARCH_CFLAGS -o $TMPE $TMPC >/dev/null 2> /dev/null ; then + if check_link; then echo "#define HAVE_MACHINE_BSWAP_H 1" >> $config_h fi fi --1.6.1.2
Quoted 9 lines · David Turner
As a related note, is anyone seriously using/developing the mainline QEMU sources on/for Windows?
If so, what is the recommended environment to do so? I'm currently using cygwin to generate
mingw-linked binaries (which dont require cygwin.dll at runtime), but I can think of other ways
to generate these:
Quoted 3 lines
- using MSYS + mingw
- using mingw and the Windows command line
- using Linux and the linux-mingw32 toolchain
Last time I needed to test QEMU on Windows I used cygwin and just configured things with: ./configure [options] --cc='gcc -mno-cygwin' and things just worked.
[..snip..]
Signature · 1 line
mailto:[email protected]
Quoted 6 lines · malc
On Wed, 10 Jun 2009, David Turner wrote:
Last time I needed to test QEMU on Windows I used cygwin and just configured things with: ./configure [options] --cc='gcc -mno-cygwin' and things just worked.
thanks malc, I believe the patch above should get rid of the need for the --cc='gcc -mno-cygwin' entirely and just auto-configure things.
Looking at configure through 'git blame' shows that the "OS_CFLAGS=-mno-cygwin" line inside it is dated January 2007. So I presume that no one is really testing the mainline sources on Windows on a regular basis :-(
On Thu, Jun 11, 2009 at 12:09 AM, David Turner<[email protected]> wrote:
[snip]
Quoted 4 lines
Looking at configure through 'git blame' shows that the "OS_CFLAGS=-mno-cygwin" line inside it is dated January 2007. So I presume that no one is really testing the mainline sources on Windows on a regular basis :-(
Wrong presumption. :-) Using MSYS+MinGW here.
F.
Quoted 9 lines · Filip Navara
On Thu, Jun 11, 2009 at 12:09 AM, David Turner<[email protected]> wrote:
[snip]Quoted 3 lines
Looking at configure through 'git blame' shows that the "OS_CFLAGS=-mno-cygwin" line inside it is dated January 2007. So I presume that no one is really testing the mainline sources on
Windows
Quoted 1 line
on a regular basis :-(
Wrong presumption. :-) Using MSYS+MinGW here.
Mea culpa :-) Thanks for all the answers. As an after-thought, it seems the patch could be
greatly simplified by just forcing the compiler to "gcc -mno-cygwin" if a Cygwin environment
is detected.
I still think that the check_compile() / check_link() helpers are a good ideas, but they are not
directly related to this issue, so they'd better be in a different patch.
I'll send these soon.
Thanks
Quoted 3 lines
F.
And here comes a new patch to fix the Cygwin build:
From 3e7486b8562fde1c291515eae22bf67b484a775f Mon Sep 17 00:00:00 2001
From: David Turner <[email protected]>
Date: Thu, 11 Jun 2009 01:26:45 +0200
Subject: [PATCH] Fix the cygwin build by forcing the compiler to use the -mno-cygwin flag.
Without this change, all feature tests were run against the nearly-Posix Cygwin headers, generating a config-host.h file that didn't correspond to the features of the Mingw headers used at build time.
This resulted in errors when trying to include things like <sys/uio.h> or <fnmatch.h> which are not available from Mingw.
--- configure | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
configure +1 -1
@@ -215,7 +215,7 @@ fi case $targetos in CYGWIN*) mingw32="yes" -OS_CFLAGS="-mno-cygwin" +cc="$cc -mno-cygwin" if [ "$cpu" = "i386" ] ; then kqemu="yes" fi
Signature · 1 line
1.6.1.2
And here's the patch inlined:
Quoted 1 line
From
3e7486b8562fde1c291515eae22bf67b484a775fMon Sep 17 00:00:00 2001
From: David Turner <[email protected]>
Date: Thu, 11 Jun 2009 01:26:45 +0200
Subject: [PATCH] Fix the cygwin build by forcing the compiler to use the -mno-cygwin flag.
Without this change, all feature tests were run against the nearly-Posix Cygwin headers, generating a config-host.h file that didn't correspond to the features of the Mingw headers used at build time.
This resulted in errors when trying to include things like <sys/uio.h> or <fnmatch.h> which are not available from Mingw.
--- configure | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
configure +1 -1
@@ -215,7 +215,7 @@ fi case $targetos in CYGWIN*) mingw32="yes" -OS_CFLAGS="-mno-cygwin" +cc="$cc -mno-cygwin" if [ "$cpu" = "i386" ] ; then kqemu="yes" fi
Signature · 1 line
1.6.1.2
Quoted 2 lines · David Turner
And here comes a new patch to fix the Cygwin build:
Quoted 9 lines · David Turner
Quoted 6 lines · malc
On Wed, 10 Jun 2009, David Turner wrote:
Last time I needed to test QEMU on Windows I used cygwin and just configured things with: ./configure [options] --cc='gcc -mno-cygwin' and things just worked.
Quoted 7 lines
thanks malc, I believe the patch above should get rid of the need for the --cc='gcc -mno-cygwin' entirely and just auto-configure things.
Looking at configure through 'git blame' shows that the "OS_CFLAGS=-mno-cygwin" line inside it is dated January 2007. So I presume that no one is really testing the mainline sources on Windows on a regular basis :-(
I believe Anthony tests it on Linux via cross-mingw.
Signature · 1 line
mailto:[email protected]
Quoted 1 line · malc
I believe Anthony tests it on Linux via cross-mingw.
For other projects, I find cross-mingw under Linux runs ./configure and compiles about 10 times faster than Cygwin (for ./configure) + Mingw (compiler) native on the same machine inside KVM.
I'm not sure if that's KVM being slow at running Windows guest processes, or if what I've heard about Cygwin being slow to spawn processes is the reason.
Either way, cross-mingw is great for Windows development :-)
(But not 64-bit yet).
-- Jamie
Quoted 7 lines · Jamie Lokier
Quoted 1 line · malc
I believe Anthony tests it on Linux via cross-mingw.
For other projects, I find cross-mingw under Linux runs ./configure and compiles about 10 times faster than Cygwin (for ./configure) + Mingw (compiler) native on the same machine inside KVM.
Quoted 7 lines
I'm not sure if that's KVM being slow at running Windows guest processes, or if what I've heard about Cygwin being slow to spawn processes is the reason.
Either way, cross-mingw is great for Windows development :-)
(But not 64-bit yet).
There is a mingw64 project that is under active development that aims to support both Win32 and Win64 APIs. It may well already be good enough to test QEMU builds for Win64, though I've not had personal experiance of it
Regards,
Daniel
Signature · 4 lines
|: Red Hat, Engineering, London -o- http://people.redhat.com/berrange/ :| |: http://libvirt.org -o- http://virt-manager.org -o- http://ovirt.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: GnuPG: 7D3B9505 -o- F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|
Quoted 3 lines · Daniel P. Berrange
There is a mingw64 project that is under active development that aims
to support both Win32 and Win64 APIs. It may well already be good enough to test QEMU builds for Win64, though I've not had personal experiance of it
FWIW the Mingw64 port is in reasonably good shape (the only reason it's still marked as beta is because the project feels they don't want to change this until all of the gcc languages are supported). They have a good history of working with open source projects to fix any bugs that arise, and generally are very helpful with bug reports (perhaps more so than the original MingW project).
http://sourceforge.net/projects/mingw-w64
ATB,
Mark.
Signature · 5 lines
Mark Cave-Ayland - Senior Technical Architect PostgreSQL - PostGIS Sirius Corporation plc - control through freedom http://www.siriusit.co.uk t: +44 870 608 0063
Quoted 1 line · David Turner
As a related note, is anyone seriously using/developing the mainline QEMU sources on/for Windows?
I don't consider myself "seriously developing" qemu but...
Quoted 1 line
If so, what is the recommended environment to do so? I'm currently using
MSYS + mingw + msysgit works fine for me
There is a resent post around here about VS port of qemu also, if you're interested
Quoted 1 line
Finally, what is the best way to send patches to this list?. I notice
Inline and/or plain text attachments are generally accepted
Quoted 2 lines
that many patches are also sent directly to various developers, and that they tend to get reviewed/accepted/rejected a tad more rapidly.
That seems to be true. Some folks here prefer to be always cc'ed. That does not work for me. I can post to the gmane newsgroup only from this location due to stupid firewall rules.
Quoted 1 line
By the way, I'd be happy to regularly check the Windows mainline build if that can help.
Well, an extra pair of eyes certainly would not hurt...
Quoted 3 lines
I'm also preparing a series of patches that fix several Windows-specific issues (most of them related to this horrible thing they called Winsock...).
You scared me :)
Quoted 4 lines
Thanks for your time.
- David